package com.zs.diveinspringbootkotlin.bootstrap

import com.zs.diveinspringbootkotlin.annotation.EnableHelloWorld
import org.springframework.boot.WebApplicationType
import org.springframework.boot.builder.SpringApplicationBuilder

/**
 *
 * @description
 * @author madison
 * @date 2021/6/3 18:15
 *
 */
@EnableHelloWorld
class EnableHelloWorldBootstrap

fun main(array: Array<String>) {
    val context = SpringApplicationBuilder(EnableHelloWorldBootstrap::class.java)
        .web(WebApplicationType.NONE)
        .run(*array)

    var helloWorld = context.getBean("helloWorld", Int::class)
    println("helloWorld Bean:$helloWorld")

    // 关闭上下文
    context.close()
}